package com.luxuewen.sxa.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;

/**
 * 
 * @author wen
 * @TableName sxa_menus
 */
@TableName(value ="sxa_menus")
@Data
public class SxaMenus implements Serializable {
    /**
     * 后台菜单表
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 菜单序号
     */
    @NotNull
    private Integer sort;

    /**
     * 上级菜单
     */
    @NotNull
    private Integer parentId;

    /**
     * 菜单类型：1，菜单；2，iframe；3，外链；4，按钮
     */
    @NotNull
    private Integer type;

    /**
     * 菜单标题
     */
    @NotNull
    private String title;

    /**
     * 菜单别名
     */
    private String name;

    /**
     * 菜单图标
     */
    private String icon;

    /**
     * 菜单路由
     */
    private String path;

    /**
     * 菜单重定向
     */
    private String redirect;

    /**
     * 菜单视图
     */
    private String component;

    /**
     * 菜单颜色
     */
    private String color;

    /**
     * 隐藏菜单：0，隐藏；1，显示
     */
    private Integer isHidden;

    /**
     * 隐藏面包屑：0，隐藏；1，显示
     */
    private Integer isBreadcrumb;

    /**
     * 整页路由：0，否；1，是
     */
    private Integer isFullpage;

    /**
     * 菜单状态：0，无效；1，有效
     */
    private Integer status;

    /**
     * 创建时间
     */
    @TableField(value="created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(value="updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    /**
     * 删除时间(全库默认软删)
     */
    @TableField(value="deleted_at")
    private LocalDateTime deletedAt;

    @TableField(exist = false)
    private List<SxaApis> apiList;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SxaMenus other = (SxaMenus) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort()))
            && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getIcon() == null ? other.getIcon() == null : this.getIcon().equals(other.getIcon()))
            && (this.getPath() == null ? other.getPath() == null : this.getPath().equals(other.getPath()))
            && (this.getRedirect() == null ? other.getRedirect() == null : this.getRedirect().equals(other.getRedirect()))
            && (this.getComponent() == null ? other.getComponent() == null : this.getComponent().equals(other.getComponent()))
            && (this.getColor() == null ? other.getColor() == null : this.getColor().equals(other.getColor()))
            && (this.getIsHidden() == null ? other.getIsHidden() == null : this.getIsHidden().equals(other.getIsHidden()))
            && (this.getIsBreadcrumb() == null ? other.getIsBreadcrumb() == null : this.getIsBreadcrumb().equals(other.getIsBreadcrumb()))
            && (this.getIsFullpage() == null ? other.getIsFullpage() == null : this.getIsFullpage().equals(other.getIsFullpage()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()))
            && (this.getDeletedAt() == null ? other.getDeletedAt() == null : this.getDeletedAt().equals(other.getDeletedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode());
        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getIcon() == null) ? 0 : getIcon().hashCode());
        result = prime * result + ((getPath() == null) ? 0 : getPath().hashCode());
        result = prime * result + ((getRedirect() == null) ? 0 : getRedirect().hashCode());
        result = prime * result + ((getComponent() == null) ? 0 : getComponent().hashCode());
        result = prime * result + ((getColor() == null) ? 0 : getColor().hashCode());
        result = prime * result + ((getIsHidden() == null) ? 0 : getIsHidden().hashCode());
        result = prime * result + ((getIsBreadcrumb() == null) ? 0 : getIsBreadcrumb().hashCode());
        result = prime * result + ((getIsFullpage() == null) ? 0 : getIsFullpage().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        result = prime * result + ((getDeletedAt() == null) ? 0 : getDeletedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", sort=").append(sort);
        sb.append(", parentId=").append(parentId);
        sb.append(", type=").append(type);
        sb.append(", title=").append(title);
        sb.append(", name=").append(name);
        sb.append(", icon=").append(icon);
        sb.append(", path=").append(path);
        sb.append(", redirect=").append(redirect);
        sb.append(", component=").append(component);
        sb.append(", color=").append(color);
        sb.append(", isHidden=").append(isHidden);
        sb.append(", isBreadcrumb=").append(isBreadcrumb);
        sb.append(", isFullpage=").append(isFullpage);
        sb.append(", status=").append(status);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", deletedAt=").append(deletedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}